<%@page import="com.liferay.portal.kernel.util.Constants"%>
<%@page import="qldc.pm.tienan.model.YeuCauTrichLuc"%>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.kernel.dao.search.ResultRow"%>

<%@include file="../../init.jsp"%>

<%
	PortletURL redirectURL = renderResponse.createRenderURL();
	redirectURL.setParameter("mvcPath", "/html/view.jsp");
	redirectURL.setParameter("chonChucNangItem", TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC);

	ResultRow row = (ResultRow) request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
	YeuCauTrichLuc yeuCauTrichLuc = (YeuCauTrichLuc) row.getObject();
	String primKey = String.valueOf(yeuCauTrichLuc.getYeuCauTrichLucId());
	PortletURL inReportURL = renderResponse.createActionURL();
	inReportURL.setParameter(TienAnConstants.ACTION_HANDLER_PARAM, TienAnConstants.REPORT_ACTION);
	inReportURL.setParameter(Constants.ACTION, "inReportQuanLyYeuCauTrichLuc");
	inReportURL.setParameter("redirect", redirectURL.toString());
	inReportURL.setParameter("yeuCauTrichLucId", primKey);
%>

<liferay-ui:icon-menu message="thao-tac">
<%
if (!yeuCauTrichLuc.getDaTrichLuc()){
	

%>
	<portlet:renderURL var="suaYeuCauTrichLucTienAn">
		<portlet:param name="mvcPath" value="/html/view.jsp" />
		<portlet:param name="chonChucNangItem" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC%>" />
		<portlet:param name="tabs1" value="cap_nhat_yeu_cau_trich_luc" />
		<portlet:param name="redirect" value="<%=redirectURL.toString()%>" />
		<portlet:param name="yeuCauTrichLucId" value="<%=primKey%>" />
		<portlet:param name="mode" value="edit" />
	</portlet:renderURL>

	<liferay-ui:icon image="edit" message="sua-yeu-cau-trich-luc" url="<%=suaYeuCauTrichLucTienAn.toString() %>" />
	
	<portlet:renderURL var="trichLuc">
		<portlet:param name="mvcPath" value="/html/view.jsp" />
		<portlet:param name="chonChucNangItem" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC%>" />
		<portlet:param name="tabs1" value="doi_tuong_trich_luc" />
		<portlet:param name="redirect" value="<%=redirectURL.toString()%>" />
		<portlet:param name="yeuCauTrichLucId" value="<%=primKey%>" />
	</portlet:renderURL>

	<liferay-ui:icon image="export" message="thuc-hien-trich-luc" url="<%=trichLuc.toString()%>" />
	<%
} else {
	%>
	<portlet:renderURL var="trichLucTienAnURL">
				<portlet:param name="mvcPath" value="/html/view.jsp" />
				<portlet:param name="chonChucNangItem" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC %>" />
				<portlet:param name="tabs1" value="trich_luc_tien_an" />
			<portlet:param name="redirect" value="<%=redirectURL.toString() %>"/>
				<portlet:param name="yeuCauTrichLucId" value="<%=primKey%>" />
			</portlet:renderURL>
		
		<liferay-ui:icon image="export" message="ket-qua-trich-luc" url="<%=trichLucTienAnURL.toString() %>" />
<%}
	%>
		<liferay-ui:icon image="print" message="in-yeu-cau-trich-luc" url="<%=\"javascript:\" + \"inDuLieu(\'\" + inReportURL.toString() + \"\')\" %>" />

	
	

	<portlet:actionURL var="xoaYeuCauTrichLucTienAn">
		<portlet:param name="<%=TienAnConstants.ACTION_HANDLER_PARAM%>" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC%>" />
		<portlet:param name="<%=Constants.ACTION%>" value="xoaYeuCauTrichLucTienAn" />
		<portlet:param name="redirect" value="<%=redirectURL.toString()%>" />
		<portlet:param name="yeuCauTrichLucId" value="<%=primKey%>" />
	</portlet:actionURL>

	<liferay-ui:icon-delete message="xoa-yeu-cau-trich-luc" confirmation="ban-muon-xoa-yeu-cau-trich-luc-nay" url="<%=xoaYeuCauTrichLucTienAn.toString()%>" />

</liferay-ui:icon-menu>


<script>
	function inDuLieu(url) {
		var form = $("<form>").attr({
			action : url,
			method : "POST",
			target : "_blank"
		});
		form.appendTo(document.body).submit();

	}
</script>